<template>
    <div 
    v-if="!isHavingPower || !isLogin"
    class="shade"
    :style="{
        'backgroundImage': `url(${bcgImg})`
    }"
    >
        <div 
        class="shade-box"
        >
            <div 
            class="section-item no-permission"
            v-if="isLogin && !isHavingPower"
            >
                <div class="tip">
                    查看更多{{name}}，需要使用企业画像次数，目前您的企业画像查看次数为{{surplusNum}}次，使用后，该企业画像可一周内随意查看。
                </div>

                <div 
                v-if="surplusNum !== 0" 
                class="btn"
                @click="$emit('use')"
                >
                    立即使用
                </div>
            </div>

            <div 
            class="section-item no-login"
            v-if="!isLogin"
            >
                <div>
                    查看{{name}}，需要您进行先登录
                </div>
                
                <div
                class="btn"
                @click="showDialogLogin"
                >
                    登录
                </div>
            </div>

            <div class="example-content">
                <div class="title">
                    打通企业库、项目库、招标库多源数据，多维度进行数据分析
                </div>

                <el-image 
                    :src="currentImg"
                ></el-image>
            </div>
        </div>
    </div>
</template>

<script>
import { mapGetters, } from 'vuex';

import img1 from '@images/portraits/business-1.png';
import img2 from '@images/portraits/business-2.png';
import img3 from '@images/portraits/zb-1.png';
import currentImg from '@images/portraits/zb-charts-1.png';

export default {
    props: {
        isLogin: {
            type: Boolean,
            default: false,
        },
        isHavingPower: {
            type: Boolean,
            default: false,
        },
        type: {
            type: String,
            default: '',
        },
        surplusNum: {
            type: Number,
            default: 0,
        },
        imgType: {
            type: String,
            default: '',
        }
    },
    data() {
        return {
            dialogVisible:false,

            currentImg, // 下方示例图
        }
    },
    computed: {
        ...mapGetters({
            statisticData: 'userinfo/getStatisticData',
        }),
        name() {
            let switchObj = {
                business:"企业信息",
                analysis:"招/中标分析" 
            }
            return switchObj[this.type] || ""
        },
        // 整体背景图
        bcgImg(){
            let switchObj = {
                business1:img1,
                business2:img2,
                zb:img3 
            };

            return switchObj[this.imgType]
        },
    },
    methods: {
        showDialogLogin() {
            this.$store.dispatch('global-dialog/showLogin')
        },
    },
    created() {
        
    },
    mounted() {
        
    },
}
</script>

<style lang="scss" scoped>
    @import '@css/var.scss';

    .shade {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 500px;
        background-size: cover;
        background-repeat: no-repeat;
        background-position: top center;
        
        .shade-box {
            display: flex;
            flex-direction:column;
            justify-content: center;
            align-items: center;
            width: 703px;
            padding: 15px 20px;
            background-color: #fff;
            font-weight: 600;
            font-size: 14px;
            box-shadow: 0px 0px 1.1px rgba(0, 0, 0, 0.017), 0px 0px 3.1px rgba(0, 0, 0, 0.025), 0px 0px 7.5px rgba(0, 0, 0, 0.033), 0px 0px 25px rgba(0, 0, 0, 0.05);


            .btn {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 116px;
                height: 32px;
                background-color: $warningColor;
                color: #fff;
                margin: 40px auto 0;
                cursor: pointer;
                transition: all .3s;

                &:hover{
                    background-color: $warningColor8;
                }
            }

            .example-content {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                margin-top: 20px;
                padding: 11px;
                border: 1px solid #ccc;

                .title {
                    font-size: 12px;
                    font-weight: 400;
                    margin-bottom: 16px;
                }
            }
        }
    }
</style>
